
# 自定义jwt认证成功返回数据    dev中进行配置
from rest_framework_jwt.utils import jwt_payload_handler


def jwt_response_payload_handler(token, user=None, request=None):
    return {
        'token': token,
        'id': user.id,
        'username': user.username
    }
# 自定义payload
def meiduo_payload_handler(user):
    # 重用某个方法直接调用某个方法
    payload = jwt_payload_handler(user)
    # 删除邮箱
    del payload["email"]
    # 添加手机号
    payload["mobile"]=user.mobile
    return payload